GtkFileChooserWidget: Use ratio in formatted times
authorMatthias Clasen <mclasen@redhat.com>
Fri, 22 Aug 2014 05:47:21 +0000 (01:47 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 22 Aug 2014 06:04:31 +0000 (02:04 -0400)
This matches what we do in other places now.

gtk/gtkfilechooserwidget.c

index 57f00723992b4e0761feff222db1f992624cd23e..b994904612afb689b47a443dc1a2f9a5aca18364 100644 (file)
@@ -3717,6 +3717,22 @@ stop_loading_and_clear_list_model (GtkFileChooserWidget *impl,
     gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), NULL);
 }
 
+/* Replace 'target' with 'replacement' in the input string. */
+static gchar *
+string_replace (const gchar *input,
+                const gchar *target,
+                const gchar *replacement)
+{
+  gchar **pieces;
+  gchar *output;
+
+  pieces = g_strsplit (input, target, -1);
+  output = g_strjoinv (replacement, pieces);
+  g_strfreev (pieces);
+
+  return output;
+}
+
 static char *
 my_g_format_time_for_display (GtkFileChooserWidget *impl,
                               glong secs)
@@ -3750,6 +3766,14 @@ my_g_format_time_for_display (GtkFileChooserWidget *impl,
 
   date_str = g_date_time_format (time, format);
 
+  if (g_get_charset (NULL))
+    {
+      gchar *ret;
+      ret = string_replace (date_str, ":", "\xE2\x80\x8E∶");
+      g_free (date_str);
+      date_str = ret;
+    }
+
   g_date_time_unref (time);
   g_date_time_unref (now);